package com.ws.mbp.springsecuritydemo.service.impl;

import com.ws.mbp.springsecuritydemo.bean.Users;
import com.ws.mbp.springsecuritydemo.mapper.UsersMapper;
import com.ws.mbp.springsecuritydemo.service.UsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Optional;

@Service
public class UsersServiceImpl implements UsersService {
    @Autowired
    UsersMapper usersMapper;

    @Override
    public int add(Users user) {
        return usersMapper.insert(user);
    }

    @Override
    public Optional<Users> findByUsername(String username) {
        System.out.println("UsersServiceImpl 执行findByUserName了。。。。username: " + username);
        return usersMapper.findByUsername(username);
    }
}
